#!/usr/bin/env python
# sample for client

from socket import *
import sys

if len(sys.argv) <= 1:
    print "Usage: %s <IP>" % sys.argv[0]
    sys.exit(0)

host = sys.argv[1]
port = 8888

try:
    s = socket(AF_INET, SOCK_STREAM)
    s.connect((host, port))
    while True:
        try:
            data = raw_input('>')
            s.sendall(data)
        except EOFError, e:
            break
    s.close()
except error, e:
    print 'Error sending data to %s' % e
    sys.exit(1)
